#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <set>


using namespace std;


//method 1 test on 1337 online judge and pass all the test
class Solution {
    public:
        int divide(int dividend, int divisor) {
            if (dividend == 0) return 0;
            if (divisor == 1) return dividend;
            if (divisor == -1) return -dividend;
            long long a = dividend, b = divisor;
            int msb = 1;
            int sign = 1;
            int ans = 0;
            if (a < 0) {sign *= -1; a *= -1;}
            if (b < 0) {sign *= -1; b *= -1;}
            while (b << msb <= a) {
                msb++;
            }
            
            for (int i = msb; i>=0; i--) {
            //    cout << dividend << endl;
                if (b << i > a)
                    continue;
                a -= b <<i;
                ans |= 1 << i;
            }
            return sign * ans;
        }
};

//method2 test on 1337 online judge and pass all the test
#define EPS 0.000001
class Solution1 {
    public:
        int divide(int dividend, int divisor) {
            int ans = 0;
            int sign = 1;
            long long a = dividend, b = divisor;
            if (dividend == 0) return 0;
            if (divisor == 1) return dividend;
            if (divisor == -1) return -dividend;

            if (dividend < 0) {
                sign *= -1;
                 a  = -a;
            }

            if (divisor < 0) {
                sign *= -1; b = -b;}
            double lo = 0, hi = a;
            double mid;
            while (1) {
                mid = lo + (hi-lo)/2;
                if (abs(mid * b - a) < EPS) break;
                if (mid * b > a) hi = mid;
                else lo = mid;
            }
            return sign * (int)(mid);
        }
};

int main(int argc, char **argv)
{
    Solution mySolution;
    int result;
   // int result = mySolution.divide(7,2);
   // cout << result << endl;


    result = mySolution.divide(1,1);
    cout << result << endl;
}
